package com.antcom.antread.antreaddatacrawl.himalayaData.dao;

import com.antcom.antread.antreaddatacrawl.himalayaData.dao.repository.BookInfoRepository;
import com.antcom.antread.antreaddatacrawl.himalayaData.entity.BookInfo;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
import java.util.Optional;

/**
 * BOOKInfo: dao
 *
 * @Author 中国蚂蚁技术有限公司
 * @create 2020/11/28 23:36
 */
@Named
public class BookInfoDao {

    @Inject
    private BookInfoRepository bookInfoRepository;

    public Optional<BookInfo> findOne(String bookInfo){
        return bookInfoRepository.findById(bookInfo);
    }

    public List<BookInfo> findByBookName(String name){
        return bookInfoRepository.findByBookNameLike("%"+name+"%");
    }

}
